package com.example.userdome.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.userdome.mapper.ScoreMapper;

import com.example.userdome.mapper.UserMapper;
import com.example.userdome.pojo.Score;

import com.example.userdome.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DeleteServiceImpl {
    @Resource
    private UserMapper userMapper;
    @Resource
    private ScoreMapper scoreMapper;

    //实现删除用户表（学生学号）即可删除学生相应成绩
    public boolean deleteStudent(Integer id) {
        Integer deleteCount = userMapper.deleteById(id);
        if (deleteCount <= 0) {
            return false;
        }
        QueryWrapper<Score> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        scoreMapper.delete(queryWrapper);
        return true;
    }
}




